package com.wwwc.index.servlet;

import java.io.*;
import java.text.*;
import java.util.*;

public class ForumDetails implements java.io.Serializable {
    private int fileId;          //1
    private String directoryId;  //2
    private int groupId;         //3
    private int position;        //4
    private int parentId;        //5
    private int totalReply;      //6
    private String path;         //7
    private int size;            //8
    private int readers;         //9
    private float rating;        //10
    private Date timeStamp;      //11
    private String title;        //12
    private String user;         //13
    private String text;         //14
    private String image;        //15
    private String link;         //16
    private boolean allowReply;  //17
    private boolean onTop;       //18
    private boolean removed;     //19
    private String userIp;       //20

    public ForumDetails(int id, String dir_id, int group_id, int position, int parent_id, int treply,
			String path, int size, int readers, float rating, Date time_stamp, String title, 
			String user, String text, String image, String link, boolean allow_reply, 
			boolean on_top, boolean removed, String user_ip) 
    {
        this.fileId      = id;
	this.directoryId = dir_id;
        this.groupId     = group_id;
        this.position    = position;
        this.parentId    = parent_id;
        this.totalReply  = treply;
        this.path        = path;
        this.size        = size;
        this.readers     = readers;
        this.rating      = rating;
        this.timeStamp   = time_stamp;
        this.title       = title;
	this.user        = user;
        this.text        = text;
        this.image       = image;
        this.link        = link;
        this.allowReply  = allow_reply;
	this.onTop       = on_top;
        this.removed    = removed;
        this.userIp     = user_ip;
    }

    public int getFileId() {
        return this.fileId;
    }
    public String getDirectoryId() {
        return this.directoryId;
    }
    public int getGroupId() {
        return this.groupId;
    }
    public int getPosition() {
        return this.position;
    }
    public int getParentId() {
        return this.parentId;
    }
    public int getTotalReply() {
        return this.totalReply;
    }
    public String getPath() {
        return this.path;
    }
    public int getSize() {
        return this.size;
    }
    public int getReaders() {
        return this.readers;
    }
    public float getRating() {
        return this.rating;
    }
    public Date getDate() {
        return this.timeStamp;
    }

    public java.sql.Date getTimeStamp() {
        return (new java.sql.Date(this.timeStamp.getTime()));
    }

    public String getTitle() {
        return this.title;
    }

    public String getUser() {
        return this.user;
    }
    public String getText() {
        return this.text;
    }
    public String getImage() {
        return this.image;
    }
    public String getLink() {
        return this.link;
    }
    public boolean allowReply() {
        return this.allowReply;
    }

    public boolean onTop() {
        return this.onTop;
    }
    public boolean isRemoved() {
        return this.removed;
    }
    public String getUserIp() {
        return this.userIp;
    }

    public static String getCreateTableQuery(String table_name) {
	StringBuffer sbf = new StringBuffer();
	sbf.append("CREATE TABLE "+table_name);
	sbf.append("(ID INTEGER PRIMARY KEY,");
	sbf.append("DIRECTORY_ID VARCHAR(200),");
	sbf.append("GROUP_ID INTEGER,");
	sbf.append("POSITION INTEGER,");
	sbf.append("PARENT_ID INTEGER,");
	sbf.append("TOTAL_REPLY INTEGER,");
	sbf.append("PATH VARCHAR(200),");
	sbf.append("SIZE INTEGER,");
	sbf.append("READERS INTEGER,");
	sbf.append("RATING NUMERIC(10,2),");
	sbf.append("DATE TIMESTAMP,");
	sbf.append("TITLE VARCHAR(250),");
	sbf.append("USER VARCHAR_IGNORECASE(20),");
	sbf.append("TEXT VARCHAR_IGNORECASE(120000),");
	sbf.append("IMAGE VARCHAR_IGNORECASE(500),");
	sbf.append("LINK VARCHAR_IGNORECASE(500),");
	sbf.append("ALLOW_REPLY BIT,");
	sbf.append("ON_TOP BIT,");
	sbf.append("REMOVED BIT,");
	sbf.append("USER_IP VARCHAR(20));");
	return sbf.toString();
    }
 }






